//
//  BaseViewController.m
//  MoodMovie
//
//  Created by 周文松 on 14-7-22.
//  Copyright (c) 2014年 com.talkweb.MoodMovie. All rights reserved.
//

#import "BaseViewController.h"
#import "BRNavigationController.h"

@interface BaseViewController()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = RGB_HEX(0xf1f1f1, 1.0);
    // 导航栏右滑返回手势
    self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
}

- (id)initWithParameters:(id)parameters {
    if ((self = [super init])) {
        _parameters = parameters;
    }
    return self;
    
}

- (void)setConnection:(NSURLConnection *)connection {
    _connection = connection;
}

- (void)presentViewController:(UIViewController *)viewcontroller {
    viewcontroller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentViewController:viewcontroller animated:YES completion:nil];
}

- (void)dismissViewController {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)addNavigationWithPresentViewController:(UIViewController *)viewcontroller {
    BRNavigationController *nav = [[BRNavigationController alloc] initWithRootViewController:viewcontroller];
    [self presentViewController:nav];
    
}

#pragma mark - 取消一切编辑事件
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

@end
